package ling.common.domain.entity;

import com.easy.query.core.annotation.Column;
import com.easy.query.core.annotation.ColumnIgnore;
import com.easy.query.core.annotation.EasyWhereCondition;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AccessLevel;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Data
public abstract class CU2Entity<T extends Comparable<T> & Serializable> extends CreatedEntity<T> implements IUpdatedEntity<Long>{

    @Data
    public static class LongId extends CU2Entity<Long> implements IExtendInfo {

        @Getter(AccessLevel.NONE)
        @Setter(AccessLevel.NONE)
        @ColumnIgnore
        HashMap<String, Object> extendMap=new HashMap<>();

        public Map<String,Object> getExtendMap(){
            return extendMap;
        }

        @EasyWhereCondition(type = EasyWhereCondition.Condition.EQUAL)
        @Column(primaryKey = true,generatedKey = true)
        Long id;
    }

    /**
     * 更新者
     */
    private Long updatedId;


    /**
     * 更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updatedTime;
}
